import Mock from 'mockjs';

// 设置延时时间
Mock.setup({
    timeout: "300-1000",
});

export function Home() {
    let menu = Mock.mock({
        "menu|5": [
            {
                "nid|+1": 1,
                "nname": "@ctitle(10)"
            },
        ],
    }).menu;
    let kmenu = Mock.mock({
        "menu|5": [
            {
                "sid|+1": 1,
                "sname": "@ctitle(10)"
            },
        ],
    }).menu;
    let menu1 = Mock.mock({
        "menu|5": [
            {
                "tid|+1": 1, 
                "tname": "@ctitle(10)"
            },
        ],
    }).menu;
    let menu2 = Mock.mock({
        "menu|5": [
            {
                "sid|+1": 1,
                "sname": "@ctitle(10)"
            },
        ],
    }).menu;
    let menu3 = Mock.mock({
        "menu|6": [
            {
                'answer': "@ctitle(10)",
                'jiexi': "@ctitle(10)",
                'nname': "@ctitle(2)",
                'qid|+1': 1,
                'sname': "@ctitle(3)",
                'title': "@ctitle(3)",
                'tname': "@ctitle(2)",
                'xuanxiang': "@ctitle(4)",
                'zhishidian': "@cparagraph(2,10,3)",
            },
        ],
    }).menu;
    //实现对拦截到请求的处理
    Mock.mock("/question/nd/list", "get", () => {
        return menu;
    });
    Mock.mock("/question/nd/klist", "get", () => {
        return kmenu;
    });
    Mock.mock("/question/type/list", "get", () => {
        return menu1;
    });
    Mock.mock("/question/type/list1", "get", () => {
        return menu2;
    });
    Mock.mock(/\/question\/nd\/select/, "get", () => {
        return menu3;
    });
    Mock.mock(/\/question\/type\/select/, "get", () => {
        return menu3;
    });
    Mock.mock(/\/question\/qdetails\/select/, "get", () => {
        return menu3;
    });
    Mock.mock(/\/question\/qdetails\/get/, "get", () => {
        return menu3;
    });
    Mock.mock(/\/question\/qdetails\/delete/, "delete", () => {
        // console.log(11111);
        return '';
    });
    Mock.mock(/\/question\/qdetails\/findAll/, [{
        'answer': "@ctitle(10)",
        'jiexi': "@ctitle(10)",
        'nname': "@ctitle(2)",
        'qid|+1': 1,
        'sname': "@ctitle(3)",
        'title': "@ctitle(3)",
        'tname': "@ctitle(2)",
        'xuanxiang': "@ctitle(4)",
        'zhishidian': "@ctitle(50)",
    }]
    );
    Mock.mock(/\/question\/qdetails\/add/, "post", () => {
        // console.log(11111);
        return '';
    });
}
